// 管理文章相关的接口
import { request } from "@/utils";

// 获取频道数据的API
export function getChannelsAPI(){
    return request({
        url:'/channels',
        method:'GET'
    })
}

// 提交文章的API
export function submitArticleAPI(articleForm){
    return request({
        url:'/mp/articles',
        method:'POST',
        data:articleForm
    })
}

// 更新文章的API
export function updateArticleAPI(articleForm){
    return request({
        url:`/mp/articles/${articleForm.id}`,
        method:'PUT',
        data:articleForm
    })
}

// 获取文章的API
export function getArticleAPI(params){
    return request({
        url:'/mp/articles',
        method:'GET',
        params
    })
}

// 删除文章的API
export function deleteArticleAPI(id){
    return request({
      url: `/mp/articles/${id}`,
      method:'DELETE'
    });
}

// 回填文章数据
export function getArticleByIdAPI(id){
    return request({
      url: `/mp/articles/${id}`,
      method: "GET",
    });
}